package com.styytech.dadabao.utils;

import java.math.BigDecimal;

import android.content.Context;
import android.widget.ImageView;

import com.styytech.dadabao.widge.NumberView;
import com.styytech.dadabao.R;

public class ProductUtils {

	public static String getFormatNum(BigDecimal paramBigDecimal) {
		return String.valueOf(paramBigDecimal.setScale(2, 1).doubleValue());
	}

	public static int getFormatProgress(int paramInt) {
		return paramInt * 360 / 1000;
	}

	public static ImageView getImageView(Context paramContext, char paramChar) {
		NumberView localNumberView = new NumberView(paramContext);
		switch (paramChar) {
		default:
			return null;
		case '0':
			localNumberView.setBackgroundResource(R.drawable.product_number_0);
			return localNumberView;
		case '1':
			localNumberView.setBackgroundResource(R.drawable.product_number_1);
			return localNumberView;
		case '2':
			localNumberView.setBackgroundResource(R.drawable.product_number_2);
			return localNumberView;
		case '3':
			localNumberView.setBackgroundResource(R.drawable.product_number_3);
			return localNumberView;
		case '4':
			localNumberView.setBackgroundResource(R.drawable.product_number_4);
			return localNumberView;
		case '5':
			localNumberView.setBackgroundResource(R.drawable.product_number_5);
			return localNumberView;
		case '6':
			localNumberView.setBackgroundResource(R.drawable.product_number_6);
			return localNumberView;
		case '7':
			localNumberView.setBackgroundResource(R.drawable.product_number_7);
			return localNumberView;
		case '8':
			localNumberView.setBackgroundResource(R.drawable.product_number_8);
			return localNumberView;
		case '9':
			localNumberView.setBackgroundResource(R.drawable.product_number_9);
			return localNumberView;
		case '.':
			localNumberView
					.setBackgroundResource(R.drawable.product_number_point);
			return localNumberView;
		case '_':
			localNumberView
			.setBackgroundResource(R.drawable.product_number_underline);
		}

		return localNumberView;
	}

}